import json
from datetime import datetime, timedelta

from django.http import JsonResponse
from django.shortcuts import render

# Create your views here.
from django.views import View

# 注册
from django_redis import get_redis_connection

from apps.firmUser.models import FirmUser
from apps.jobs.models import jobs
from utils.myLoginView import MyLoginView
from zhaopi2.settings import SECRET_KEY


#获取用户发布工作列表
class GetFirmUserJobsView(MyLoginView):

    def get(self, request):

        ret = []
        try:
            datas = jobs.objects.filter(jobs_user=request.user)
        except Exception as e:
            return JsonResponse({
                "code": '407',
                "message": '重新请求'
            })
        for data in datas:
            ret.append({
                "name": data.jobs_name,
                "create_time": data.create_time,

            })
        return JsonResponse({"code": '200', "message": 'ok', "data": ret})
